/*
 * main.cpp
 * Author: Elias Capito, Yanick Candaux
 * PCM
 */
#include "def.hpp"
#include "BoardInfos.hpp"
#include "HazardQueue.hpp"
#include "SolverParallProf.hpp"
#include <iostream>
#include <ctime>

using namespace std;
using namespace pcm;

//Level 4
//Number solutions: 0
//Number solutions: 14
//Number solutions: 14
//Number solutions: 14
//Number solutions: 0
//Number solutions: 14
//Number solutions: 0
//Number solutions: 14
//Number solutions: 14
//Number solutions: 0
//Level 5
//Number solutions: 29760
//Number solutions: 14880
//Number solutions: 14880
//Number solutions: 85258
//Number solutions: 1550
//Number solutions: 85258
//Number solutions: 14880
//Number solutions: 1550
//Number solutions: 1550
//Number solutions: 14880
//Number solutions: 29760
//Number solutions: 14880
//Number solutions: 85258
//Number solutions: 14880
//Number solutions: 29760
//Level 6
//Number solutions: 43419942138
//Number solutions: 82905434589
//Number solutions: 82905434589
//Number solutions: 113077359159
//Number solutions: 29235690234
//Number solutions: 113077359159
//Number solutions: 113077359159
//Number solutions: 266871356732
//Number solutions: 266871356732
//Number solutions: 113077359159
//Number solutions: 82905434589
//Number solutions: 29235690234
//Number solutions: 266871356732
//Number solutions: 29235690234
//Number solutions: 82905434589
//Number solutions: 43419942138
//Number solutions: 82905434589
//Number solutions: 113077359159
//Number solutions: 113077359159
//Number solutions: 82905434589
//Number solutions: 43419942138
//Level 7
//Number solutions: 0
//Number solutions: 422164782932465380
//Number solutions: 422164782932465380

#define DEFAULT_NUMBER_THREAD 2
#define DEFAULT_GAME_SIZE 5
#define DEFAULT_HOLE_START 5
int main(int argc, char* argv[]){

	int boardSize = DEFAULT_GAME_SIZE;
	if(argc>1){
		 boardSize = atoi(argv[1]);
	}

	int holeStart = DEFAULT_HOLE_START;
	if(argc>2){
		holeStart = atoi(argv[2])-1;
	}
	int numberThreads = DEFAULT_NUMBER_THREAD;
	if(argc>3){
		numberThreads = atoi(argv[3]);
	}

	double init, final, tot;
	
	BoardInfos board;
	BoardInfos::updateGameInfos(boardSize);

	init = clock();
	board.initBoard(holeStart);
	SolverParallProf solver;
	LL sols = solver.solve(board,numberThreads);
	final = (clock()-init)/(double)CLOCKS_PER_SEC;
	cout<<"Number solutions: "<<sols<<endl;
	cout << "=>Time in second :"<<final << endl;

	return 0;
}

